#pragma once

class DImage;

typedef std::vector<boost::weak_ptr<DImage> > Frames;

class DAnimation
{
	friend class DIResourceManager;
public:
	DAnimation(void);
	~DAnimation(void);

	bool isSingleFrame() const;

	bool isLoop() const;
	void setLoop(bool bLoop = true);

	bool update(float dt);

    unsigned int width() const;
    unsigned int height() const;
	boost::shared_ptr<DImage> currentFrame() const;
private:
	void addFrame(boost::shared_ptr<DImage> frame);
	void setSingleFrame(bool bSingleFrame = true);
	void setDimensions(unsigned int w, unsigned int h);

	Frames m_frames;
	bool m_bSingleFrame;
	bool m_bLoop;
	int	m_nCurrentFrame;

    unsigned int m_nWidth;
    unsigned int m_nHeight;

	float m_fSpeed;
};
